/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package adsreis.com.Controls;

import adsreis.com.Beans.CondsBean;
import adsreis.com.acessobd.AcessoMySql;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Pauroenriki
 */
public class CondsControl {
    PreparedStatement pstm;
    ResultSet rs;
    String consultaCond = "SELECT * FROM CONDPGTO WHERE COND LIKE ?";
    
    
    public CondsControl(){        
    }
    public List<CondsBean> listarConds(String co){
        List<CondsBean> conds = new ArrayList();
        try{
            AcessoMySql mysql = new AcessoMySql();
           pstm = mysql.conectar().prepareStatement(consultaCond);
           pstm.setString(1, co);
           rs = pstm.executeQuery();
           CondsBean con;
           while (rs.next()){
               con = new CondsBean();
               con.setCodCond(rs.getInt("codcond"));
               con.setCond(rs.getString("cond"));               
               conds.add(con);              
           }
           mysql.desconectar();
        }catch (Exception e){
            e.printStackTrace();
        }
        return conds;        
    }
}
